<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR or Session.Manager) ){
		view.init("Step 3:  HR - Orientation",
			"/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/SCF/Step3-Orientation.js",
			"/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",index);
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="index" access="public" output="true" returntype="any">

    <!--- if the employee to hire isn't specified, redirect to Step 2 - Page 1 --->
    <cfif not isdefined("URL.StepID")>
        <cflocation url="/#Session.RootDir#/status.cfm" addtoken="no">
    </cfif>
    
    <cfscript>
        import models.*;
        FormAction = '/' & Session.RootDir & '/controller/SubmitHandler.cfm?SCFStep3=update';
        FormDecline = '/' & Session.RootDir & '/controller/SubmitHandler.cfm?SCFStep3=update&NoShow=1';
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        AccessControlQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.AccessControl");
        JustinsJobProg = CreateObject("component", session.rootDir & ".DatabaseQueries.JustinsJobProg");
        StepAction = entityLoadByPK("StepActions", URL.StepID);
        Employee = entityLoadByPK("Employee", StepAction.getEmployeeID());
        Lunch = entityLoadByPK("Lunch", Employee.getLunchID());
        GetShifts = entityload("Shift");
        GetLunches = entityload("Lunch");
        GetDepts = KronosQueries.funcGetDepts( employee.getDepartmentID() );
        GetEthnicCodes =  KronosQueries.funcGetEthnicCodes();
        GetMaritalCodes = KronosQueries.funcGetMaritalCodes();
        GetGenderCodes = KronosQueries.funcGetGenderCodes();
        GetI9Codes = KronosQueries.funcGetI9Codes();
        GetPositionInfo = KronosQueries.funcGetPositionCodes(Employee.getPositionID());        
    </cfscript>
    
    <cfoutput> 
    
        <h1 class="title">Step 3:  HR - Orientation</h1>
        <div class="entry">
            Welcome, #Session.EmpInfo.FirstName# #Session.EmpInfo.LastName#.  
            On this page we'll capture additional information obtained by HR 
            from the employee during Orientation.<br /><br />
            
            <cfform name="frmStep3" method="post">
                <table cellpadding="0" cellspacing="0" width=100%>
                    <tr>
                        <td>Employee:</td>
                        <td>#employee.getFullName()#</td>
                    </tr>
                    <tr>
                        <td>Position:</td>
                        <td>#GetPositionInfo.PositionCodeDescription# (  #GetPositionInfo.PositionCode#  )</td>
                    </tr>
                    <tr>
                        <td>Department:</td>
                        <td>#GetDepts.Org#</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <fieldset>
                                <legend></legend>
                                <table>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td>SSN:</td>
                                        <td>
                                            <cfinput type="text" name="SSN" error_message="Please provide a valid SSN or Tax ID in the format xxx-xx-xxxx" tabindex="10" value="#employee.getSSN()#" >
                                        </td>
                                        <td width=25>&nbsp;</td>
                                        <td valign="top" nowrap="nowrap">Date of Hire:</td>
                                        <TD rowspan=6>  
                                            <cfif dateformat(employee.getActStartDate(),'mm/dd/yyyy') NEQ "">
                                                <cfinput type="hidden" name="DateOfHire" error_message="Please provide a valid Date of Hire."
                                                    value="#dateformat(employee.getActStartDate(),'mm/dd/yyyy')#"/>
                                                <div id="DateOfHire_datepicker"></div>
                                                <cfinput type="hidden" name="PreFillDate" error_message="Please provide a valid Date of Hire."
                                                    value="#dateformat(employee.getActStartDate(),'mm/dd/yyyy')#">
                                            <cfelse>                                                
                                                <cfinput type="hidden" name="DateOfHire" error_message="Please provide a valid Date of Hire."
                                                    value="#dateformat(employee.getEstStartDate(),'mm/dd/yyyy')#"/>
                                                <div id="DateOfHire_datepicker"></div>
                                                <cfinput type="hidden" name="PreFillDate" error_message="Please provide a valid Date of Hire."
                                                    value="#dateformat(employee.getEstStartDate(),'mm/dd/yyyy')#">
                                            </cfif>
                                        </TD>
                                    </tr>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td>DOB:</td>
                                        <td>
                                            <cfinput type="text" name="DOB" size="20" style="margin-right:2px;" error_message="Please provide a valid Date Of Birth in the format MM/DD/YYYY" tabindex="20" value="#employee.getDOB()#" >
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td>Gender:</td>
                                        <td>
                                            <cfselect name="GenderID" query="GetGenderCodes" value="PersonCodeIDNo" display="PersonCode" tabindex="30" selected="#employee.getGenderID()#" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td nowrap="nowrap">Marital Status:</td>
                                        <td>
                                            <cfselect name="MaritalStatusID" query="GetMaritalCodes" value="PersonCodeIDNo" display="PersonCode" tabindex="40" selected="#employee.getMaritalStatusID()#"/>                        
                                        </td>
                                    </tr>
                                    <TR>
                                        <td width = "10">&nbsp;</td>
                                        <TD nowrap="nowrap">Ethnic Origin:</TD>
                                        <TD>
                                            <cfselect name="EthnicID" query="GetEthnicCodes" tabindex="50" value="EthnicCodeIDNo" display="EthnicCode" selected="#employee.getEthnicID()#" />
                                        </TD>
                                    </TR>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td valign="top">I- 9 On File:</td>
                                        <TD>
                                            <cfselect name="I9" query="GetI9Codes" tabindex="60" value="PersonCodeIDNo" display="PersonCode" selected="#employee.getI9()#"/>
                                        </TD>
                                    </TR>
                                    <tr>
                                        <td width = "10">&nbsp;</td>
                                        <td valign="top">Comments:</td>
                                        <td colspan ='5'><cftextarea name="Notes" tabindex="80" style="width:98%" /></td>
                                    </TR>
                                </table>
                            </fieldset>                            
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="5" align="right" valign="middle" style="padding-top:5px;">
                            <cfinput type="hidden" name="EmpID" value="#employee.getEmployeeID()#">
                            <cfinput type="hidden" name="StepID" value="#URL.StepID#">
                            <cfinput type="hidden" name="FormAction" value="#FormAction#">
                            <cfinput type="hidden" name="FormDecline" value="#FormDecline#">
                            <cfinput type="button" name="Submit" value="Next >>" tabindex="150" style="float:right">
                            <cfinput type="button" name="NoShow" value="No Show" tabindex="140">
                        </td>
                    </tr>                 
                </table>
            </cfform>        
        </div>    
    </cfoutput>
    
</cffunction>